import Router from 'koa-router';
import { login, register, getUserInfo, refreshToken, logout } from '../controllers/auth.controller';
import { authMiddleware } from '../middlewares/auth.middleware';

const router = new Router();

/**
 * @route POST /api/auth/login
 * @desc 用户登录
 * @access Public
 */
router.post('/login', login);

/**
 * @route POST /api/auth/register
 * @desc 用户注册
 * @access Public
 */
router.post('/register', register);

/**
 * @route GET /api/auth/info
 * @desc 获取当前用户信息
 * @access Private
 */
router.get('/info', authMiddleware, getUserInfo);

/**
 * @route POST /api/auth/refresh-token
 * @desc 刷新Token
 * @access Public
 */
router.post('/refresh-token', refreshToken);

/**
 * @route POST /api/auth/logout
 * @desc 退出登录
 * @access Private
 */
router.post('/logout', authMiddleware, logout);

export default router; 